<?php

defined( '_JEXEC' ) or die( 'Restricted access' );

jimport( 'joomla.application.component.view' );

require_once( JPATH_COMPONENT.DS.'models'.DS.'details11.php' );

class TargetsViewDetails1add extends JView {
	#var $model; 
	var $type_id;
	var $target_id;
	
	public function __construct() {
		#$this->setModel(TargetsViewDetails1);
		#$model = get
		
		$this->type_id   = JRequest::getInt('type_id');
		$this->target_id = JRequest::getInt('target_id');
		
		parent::__construct();
	}


	function display($tpl = null) {
		
	
		#$this->setModel(&$model);
		
		#$model = getModel('details11');
		
		$header = $this->get('Header2', 'details1');
		
		$detail		=& $this->get('Data');
		$isNew		= ($detail->id < 1);
		
		JToolBarHelper::title(   JText::_( 'Detail1_todo' ), 'generic.png' );
		
		$text = $isNew ? JText::_( 'New' ) : JText::_( 'Edit' );
		JToolBarHelper::title(   JText::_( $header ).': <small><small>[ ' . $text.' ]</small></small>' );
		JToolBarHelper::save();
		
		if ($isNew)  {
			JToolBarHelper::cancel();
		} else {
			// for existing items the button is renamed `close`
			JToolBarHelper::cancel( 'cancel', 'Close' );
		}
		
		$detail->type_id   = $this->type_id;
		$detail->target_id = $this->target_id;

		$this->assignRef('header', $header);
		$this->assignRef('detail', $detail);
		
		

		parent::display();
	}
}